package com.lovo.project2.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lovo.project2.bean.StockBean;
import com.lovo.project2.bean.count.PageBean;
import com.lovo.project2.service.IStockBeanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/stock")
public class StockBeanController {
    @Autowired
    IStockBeanService iStockBeanService;

    @RequestMapping("queryAllPage")
    public IPage<StockBean> queryAllPage(@RequestBody PageBean pageBean) {
        IPage iPage = new Page(pageBean.getCurrent(), pageBean.getPageSize());
        int s = 0;
        if (pageBean.getType().equals("电脑产品")) {
            s = 1;
        }
        if (pageBean.getType().equals("安防产品")) {
            s = 2;
        }
        if (pageBean.getType().equals("打印扫描设备")) {
            s = 3;
        }
        if (pageBean.getType().equals("办公耗材")) {
            s = 4;
        }
        return iStockBeanService.queryAllList(iPage, pageBean.getQueryname(), pageBean.getStateNum(),pageBean.getEntNum(), pageBean.getSqlPrice(), s);

    }


}
